import { useEffect, useState } from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import Home from './components/Home/Home';
import Sign from './components/Sign/Sign';
import redux from './utils/Redux/Redux';

export default function App() {
  const [token, setToken] = useState(redux.getState().authToken)
  useEffect(() =>
    redux.subscribe(() => {
      setToken(redux.getState().authToken)
    }), [])
  return (
    <SafeAreaProvider>
      {
        token ?
          <Home /> : <Sign />
      }
    </SafeAreaProvider>
  );
}

